import {Component, OnInit, ChangeDetectionStrategy} from '@angular/core';
import {select, Store} from '@ngrx/store';

import {AppStoreModule} from '../../../../../store';
import * as MemberSelector from '../../../../../store/selectors/member.selector';

@Component({
  selector: 'app-layer-modal',
  templateUrl: './layer-modal.component.html',
  styleUrls: ['./layer-modal.component.less'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class LayerModalComponent implements OnInit {

  constructor(
    private store$: Store<AppStoreModule>
  ) {
    const appStore$ = this.store$.pipe(select(MemberSelector.getMember));

    appStore$.pipe(select(MemberSelector.getModalVisible)).subscribe(modalVisible => {
      console.log('modalVisible: ', modalVisible);
    });

    appStore$.pipe(select(MemberSelector.getModalType)).subscribe(modalType => {
      console.log('modalType: ', modalType);
    });
  }

  ngOnInit(): void { }

}
